-module (tuples1).

-export ([test/0, test1/0 ]).

-record (person, {name, age=0, phone=""}).

birthday({Name, Age, Phone}) ->
	{Name, Age+1, Phone};
birthday(P) ->
	#person{age=Age} = P,
	P#person{age=Age+1}.

joe() ->
	{"Joe", 21, "999-999"}.

showPerson(P) ->
	case P of
		{Name, Age, Phone} ->
			io:format("name:~p age:~p phone:~p~n", [Name, Age, Phone]);
		P1 when is_record(P1, person) ->
			io:format("name:~p age:~p phone:~p~n", [P1#person.name, P1#person.age, P1#person.phone])
	end.


test() ->
	P = #person{name="leeyi", age=18, phone="13692177080"},
	showPerson(birthday(P)),
	Tp = {P#person.name++"WL", P#person.age, P#person.phone},
	showPerson(Tp),
	showPerson(joe()).

test1() ->
	showPerson(birthday(joe())).





